<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>AIfES 2: ailayer_tanh.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="AIfES_logo_small.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">AIfES 2
   &#160;<span id="projectnumber">2.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('ailayer__tanh_8h_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">ailayer_tanh.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="ailayer__tanh_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160; </div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="preprocessor">#ifndef TANH_LAYER</span></div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="preprocessor">#define TANH_LAYER</span></div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160; </div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="aifes__core_8h.html">core/aifes_core.h</a>&quot;</span></div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160; </div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structailayer__tanh.html">ailayer_tanh</a>     <a class="code" href="structailayer__tanh.html">ailayer_tanh_t</a>;</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160; </div>
<div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="structailayer__tanh.html">   47</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structailayer__tanh.html">ailayer_tanh</a> {</div>
<div class="line"><a name="l00048"></a><span class="lineno"><a class="line" href="structailayer__tanh.html#ab13782a46e3804246bf82a92955096b3">   48</a></span>&#160;    <a class="code" href="structailayer.html">ailayer_t</a> <a class="code" href="structailayer__tanh.html#ab13782a46e3804246bf82a92955096b3">base</a>; </div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160; </div>
<div class="line"><a name="l00065"></a><span class="lineno"><a class="line" href="structailayer__tanh.html#a044094cf164cf12ae0a5cc682dfc9804">   65</a></span>&#160;    void (*<a class="code" href="structailayer__tanh.html#a044094cf164cf12ae0a5cc682dfc9804">tanh</a>)(<span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *x, <a class="code" href="structaitensor.html">aitensor_t</a> *result);</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160; </div>
<div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="structailayer__tanh.html#a42dec6b025b13da223c8a8697f1c5d31">   77</a></span>&#160;    void (*<a class="code" href="structailayer__tanh.html#a42dec6b025b13da223c8a8697f1c5d31">d_tanh</a>)(<span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *tanh_x, <a class="code" href="structaitensor.html">aitensor_t</a> *result);</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160; </div>
<div class="line"><a name="l00086"></a><span class="lineno"><a class="line" href="structailayer__tanh.html#a50f5e44b0fca9c1e79a5287adb4a59eb">   86</a></span>&#160;    void (*<a class="code" href="structailayer__tanh.html#a50f5e44b0fca9c1e79a5287adb4a59eb">multiply</a>)(<span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *a, <span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *b, <a class="code" href="structaitensor.html">aitensor_t</a> *result);</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160; </div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;};</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160; </div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;<span class="keyword">extern</span> <span class="keyword">const</span> <a class="code" href="structaicore__layertype.html">aicore_layertype_t</a> *<a class="code" href="ailayer__tanh_8h.html#a199dcc8608b90dde65c0c54b949957f7">ailayer_tanh_type</a>;</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160; </div>
<div class="line"><a name="l00109"></a><span class="lineno"><a class="line" href="ailayer__tanh_8h.html#a3c100d792dd25092cff5f14bfea3ec94">  109</a></span>&#160;<a class="code" href="structailayer.html">ailayer_t</a> *<a class="code" href="ailayer__tanh_8h.html#a3c100d792dd25092cff5f14bfea3ec94">ailayer_tanh</a>(<a class="code" href="structailayer__tanh.html">ailayer_tanh_t</a> *layer, <a class="code" href="structailayer.html">ailayer_t</a> *input_layer);</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160; </div>
<div class="line"><a name="l00131"></a><span class="lineno"><a class="line" href="ailayer__tanh_8h.html#a82463c6aa5e8d1f94fb1a264412e0e36">  131</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="ailayer__tanh_8h.html#a82463c6aa5e8d1f94fb1a264412e0e36">ailayer_tanh_forward</a>(<a class="code" href="structailayer.html">ailayer_t</a> *<span class="keyword">self</span>);</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160; </div>
<div class="line"><a name="l00156"></a><span class="lineno"><a class="line" href="ailayer__tanh_8h.html#ac477848c5933f2272ca5bde9d3f7f488">  156</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="ailayer__tanh_8h.html#ac477848c5933f2272ca5bde9d3f7f488">ailayer_tanh_backward</a>(<a class="code" href="structailayer.html">ailayer_t</a> *<span class="keyword">self</span>);</div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160; </div>
<div class="line"><a name="l00167"></a><span class="lineno"><a class="line" href="ailayer__tanh_8h.html#acd79a0ed7830bdbbcae6abfd9afa3551">  167</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="ailayer__tanh_8h.html#acd79a0ed7830bdbbcae6abfd9afa3551">ailayer_tanh_calc_result_shape</a>(<a class="code" href="structailayer.html">ailayer_t</a> *<span class="keyword">self</span>);</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160; </div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;<span class="preprocessor">#ifdef AIDEBUG_PRINT_MODULE_SPECS</span></div>
<div class="line"><a name="l00174"></a><span class="lineno"><a class="line" href="ailayer__tanh_8h.html#aeffd74a2c7b34491fb2a77305608bee4">  174</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="ailayer__tanh_8h.html#aeffd74a2c7b34491fb2a77305608bee4">ailayer_tanh_print_specs</a>(<span class="keyword">const</span> <a class="code" href="structailayer.html">ailayer_t</a> *<span class="keyword">self</span>);</div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;<span class="preprocessor">#endif </span><span class="comment">// AIDEBUG_PRINT_MODULE_SPECS</span></div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160; </div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;<span class="preprocessor">#endif </span><span class="comment">// TANH_LAYER</span></div>
<div class="ttc" id="aaifes__core_8h_html"><div class="ttname"><a href="aifes__core_8h.html">aifes_core.h</a></div><div class="ttdoc">AIfES 2 core interface.</div></div>
<div class="ttc" id="aailayer__tanh_8h_html_a199dcc8608b90dde65c0c54b949957f7"><div class="ttname"><a href="ailayer__tanh_8h.html#a199dcc8608b90dde65c0c54b949957f7">ailayer_tanh_type</a></div><div class="ttdeci">const aicore_layertype_t * ailayer_tanh_type</div><div class="ttdoc">Tanh layer type.</div></div>
<div class="ttc" id="aailayer__tanh_8h_html_a3c100d792dd25092cff5f14bfea3ec94"><div class="ttname"><a href="ailayer__tanh_8h.html#a3c100d792dd25092cff5f14bfea3ec94">ailayer_tanh</a></div><div class="ttdeci">ailayer_t * ailayer_tanh(ailayer_tanh_t *layer, ailayer_t *input_layer)</div><div class="ttdoc">Initialize and connect the given Tanh layer.</div></div>
<div class="ttc" id="aailayer__tanh_8h_html_a82463c6aa5e8d1f94fb1a264412e0e36"><div class="ttname"><a href="ailayer__tanh_8h.html#a82463c6aa5e8d1f94fb1a264412e0e36">ailayer_tanh_forward</a></div><div class="ttdeci">void ailayer_tanh_forward(ailayer_t *self)</div><div class="ttdoc">Calculate the forward pass for given Tanh layer.</div></div>
<div class="ttc" id="aailayer__tanh_8h_html_ac477848c5933f2272ca5bde9d3f7f488"><div class="ttname"><a href="ailayer__tanh_8h.html#ac477848c5933f2272ca5bde9d3f7f488">ailayer_tanh_backward</a></div><div class="ttdeci">void ailayer_tanh_backward(ailayer_t *self)</div><div class="ttdoc">Calculate the backward pass for the given Tanh layer.</div></div>
<div class="ttc" id="aailayer__tanh_8h_html_acd79a0ed7830bdbbcae6abfd9afa3551"><div class="ttname"><a href="ailayer__tanh_8h.html#acd79a0ed7830bdbbcae6abfd9afa3551">ailayer_tanh_calc_result_shape</a></div><div class="ttdeci">void ailayer_tanh_calc_result_shape(ailayer_t *self)</div><div class="ttdoc">Calculate the shape of the result tensor.</div></div>
<div class="ttc" id="aailayer__tanh_8h_html_aeffd74a2c7b34491fb2a77305608bee4"><div class="ttname"><a href="ailayer__tanh_8h.html#aeffd74a2c7b34491fb2a77305608bee4">ailayer_tanh_print_specs</a></div><div class="ttdeci">void ailayer_tanh_print_specs(const ailayer_t *self)</div><div class="ttdoc">Print the layer specification.</div></div>
<div class="ttc" id="astructaicore__layertype_html"><div class="ttname"><a href="structaicore__layertype.html">aicore_layertype</a></div><div class="ttdoc">Type indicator of the layer.</div><div class="ttdef"><b>Definition:</b> aifes_core.h:82</div></div>
<div class="ttc" id="astructailayer__tanh_html"><div class="ttname"><a href="structailayer__tanh.html">ailayer_tanh</a></div><div class="ttdoc">General Tanh layer  struct.</div><div class="ttdef"><b>Definition:</b> ailayer_tanh.h:47</div></div>
<div class="ttc" id="astructailayer__tanh_html_a044094cf164cf12ae0a5cc682dfc9804"><div class="ttname"><a href="structailayer__tanh.html#a044094cf164cf12ae0a5cc682dfc9804">ailayer_tanh::tanh</a></div><div class="ttdeci">void(* tanh)(const aitensor_t *x, aitensor_t *result)</div><div class="ttdoc">Required math function: Tanh.</div><div class="ttdef"><b>Definition:</b> ailayer_tanh.h:65</div></div>
<div class="ttc" id="astructailayer__tanh_html_a42dec6b025b13da223c8a8697f1c5d31"><div class="ttname"><a href="structailayer__tanh.html#a42dec6b025b13da223c8a8697f1c5d31">ailayer_tanh::d_tanh</a></div><div class="ttdeci">void(* d_tanh)(const aitensor_t *tanh_x, aitensor_t *result)</div><div class="ttdoc">Required math function: Derivative of tanh.</div><div class="ttdef"><b>Definition:</b> ailayer_tanh.h:77</div></div>
<div class="ttc" id="astructailayer__tanh_html_a50f5e44b0fca9c1e79a5287adb4a59eb"><div class="ttname"><a href="structailayer__tanh.html#a50f5e44b0fca9c1e79a5287adb4a59eb">ailayer_tanh::multiply</a></div><div class="ttdeci">void(* multiply)(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)</div><div class="ttdoc">Required math function: Element wise tensor multiplication.</div><div class="ttdef"><b>Definition:</b> ailayer_tanh.h:86</div></div>
<div class="ttc" id="astructailayer__tanh_html_ab13782a46e3804246bf82a92955096b3"><div class="ttname"><a href="structailayer__tanh.html#ab13782a46e3804246bf82a92955096b3">ailayer_tanh::base</a></div><div class="ttdeci">ailayer_t base</div><div class="ttdoc">Inherited field members from general ailayer struct.</div><div class="ttdef"><b>Definition:</b> ailayer_tanh.h:48</div></div>
<div class="ttc" id="astructailayer_html"><div class="ttname"><a href="structailayer.html">ailayer</a></div><div class="ttdoc">AIfES layer interface.</div><div class="ttdef"><b>Definition:</b> aifes_core.h:252</div></div>
<div class="ttc" id="astructaitensor_html"><div class="ttname"><a href="structaitensor.html">aitensor</a></div><div class="ttdoc">A tensor in AIfES.</div><div class="ttdef"><b>Definition:</b> aifes_math.h:89</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_1e5d3661ed79af157d57e64a38265d09.html">basic</a></li><li class="navelem"><a class="el" href="dir_90008ee2b0f86999412b56217da88d54.html">base</a></li><li class="navelem"><a class="el" href="dir_ad1f3f314a3dbbd36ea1eb350865d78d.html">ailayer</a></li><li class="navelem"><a class="el" href="ailayer__tanh_8h.html">ailayer_tanh.h</a></li>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
